/**
 * &copy; 2006 NewInstance.it
 */
package it.newinstance.jrainbow.ui.web;

import it.newinstance.util.LabelValueBean;

import java.io.IOException;
import java.util.Set;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Luigi R. Viggiano
 * @version $Id: IndexServlet.java 138 2007-06-12 12:23:29Z luigi.viggiano $
 */
public class IndexServlet extends HttpServlet {
    private static final long serialVersionUID = 6152195806743828860L;

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String path = "/css/languages/";
        CSSLoader loader = new CSSLoader(path, getServletContext());
        Set<LabelValueBean> languages = loader.getLanguages();
        String styles = loader.getJSONStyles(languages);
        
        req.setAttribute("language", languages);
        req.setAttribute("styles", styles);
        req.getRequestDispatcher("/WEB-INF/jspx/index.jspx").forward(req, resp);
    }
}
